import { BasicColumn } from '@/components/Table';
import { Popover, Button } from '@arco-design/web-vue';
import { h } from 'vue';

export const columns: BasicColumn[] = [
  {
    title: 'ID',
    dataIndex: 'id',
  },
  {
    title: '来源',
    dataIndex: 'operation',
  },
  {
    title: '操作人',
    dataIndex: 'operator',
  },
  {
    title: 'IP',
    dataIndex: 'ip',
  },
  {
    title: '参数',
    dataIndex: 'parameter',
    render({ record }) {
      return h(
        Popover,
        {
          placement: 'bottom',
          trigger: 'hover',
          style: { 'max-width': '550px' },
          'content-style': {
            'word-break': 'break-all',
          },
          scrollable: true,
        },
        {
          default: () => h(Button, {}, { default: () => '查看参数' }),
          content: () => `${record.parameter}`,
        },
      );
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
  },
];
